{% extends 'base.html' %}
{% block title %}
    注册
{% endblock %}
{% block head %}
    <script src="{% static 'jquery/jquery-3.7.1.min.js' %}"></script>
    <script src="{% static 'js/register.js' %}"></script>
    <script>
    $(document).ready(function() {
        console.log("jQuery loaded successfully.");
    });
</script>
{% endblock %}
{% block main %}
<h1>注册</h1>
    <div style="max-width: 330px" class="m-auto">
        <form method="post" action="">
            {% csrf_token %}
            <div class="mb-3">
                <label>用户名</label>
                <input type="username" name="username" class="form-control" placeholder="用户名">
            </div>
            <div class="mb-3">
                <label>邮箱</label>
                <input type="email" name="email" class="form-control" placeholder="邮箱">
            </div>
            <div class="mb-3">
                <label>验证码</label>
                <div class="input-group mb-3">

                    <input type="text" class="form-control" placeholder="验证码" name="captcha"
                           aria-label="Recipient's username" aria-describedby="button-addon2">
                    <button class="btn btn-outline-secondary" type="button" id="captcha-btn">获取验证码</button>
                </div>
            </div>

            <div class="mb-3">
                <label>密码</label>
                <input type="password" name="password" class="form-control" placeholder="密码">
            </div>
             <div>
            {% if errors %}
                <ul class="errorlist">
                    {% for field_errors in errors.values %}
                        {% for error in field_errors %}
                            <li style="color: red">{{ error }}</li>
                        {% endfor %}
                    {% endfor %}
                </ul>
            {% endif %}
        </div>

            <div class="mb-3 mt-3">
                <button class="btn btn-primary w-100">点击注册</button>
            </div>
        </form>
    </div>
{% endblock %}